import request from '@/utils/request'

export default {
  // 获取订单列表
  getOrderList(page, limit, searchObj) {
    const params = {};
    for (const key in searchObj) {
        if (searchObj[key] !== undefined && searchObj[key] !== '') {
            params[key] = searchObj[key];
        }
    }

    return request({
      url: `/eduorder/order/list/${page}/${limit}`,
      method: 'get',
      params: params
    });
  },
  
  // 获取订单详情
  getOrderInfo(orderId) {
    return request({
      url: `/eduorder/order/getOrderInfo/${orderId}`,
      method: 'get'
    })
  },
  
  // 获取支付记录
  getPayLog(orderNo) {
    return request({
      url: `/eduorder/paylog/getPayInfo/${orderNo}`,
      method: 'get'
    })
  },
  
  // 检查支付状态
  checkPaymentStatus(orderNo) {
    return request({
      url: `/eduorder/paylog/checkPaymentStatus/${orderNo}`,
      method: 'get'
    })
  },

  // 删除订单
  deleteOrder(orderNo) {
    return request({
      url: `/eduorder/order/delete/${orderNo}`,
      method: 'delete'
    })
  }
}